package com.kfm.loginIp.util;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class RespUtil implements Serializable {

    private Integer code;

    private String msg;

    private Object data;

    public static RespUtil ok(Object data){
        return new RespUtil(200, "操作成功", data);
    }

    public static RespUtil ok(){
        return new RespUtil(200, "操作成功", null);
    }

    public static RespUtil error(String msg){
        return new RespUtil(500, msg, null);
    }

    public static RespUtil error(Integer code, String msg, Object data){
        return new RespUtil(code, msg, data);
    }
}
